<?

class EntidadDominio
{

  public $id;
  public $version;
  public $usuario;

  public function getUsuario()
  {
    return $this->usuario;
  }

  public function setUsuario($usuario)
  {
    $this->usuario = $usuario;
  }

  public function getVersion()
  {
    return $this->version;
  }

  public function setVersion($version)
  {
    $this->version = $version;
  }

  public function getId()
  {
    return $this->id;
  }

  public function setId($id)
  {
    $this->id = $id;
  }

  function getJson()
  {
    $var = get_object_vars($this);
    $this->array_remove_empty($var);
    foreach ($var as &$value)
    {
      if (is_object($value) && method_exists($value, 'getJsonData'))
      {
        //$value = $value->getJson();
      }
    }
    $this->array_remove_empty($var);
    return $var;
  }

  function array_remove_empty(&$haystack)
  {
    foreach ($haystack as $key => $value)
    {
      if (is_array($value))
      {
        $haystack[$key] = $this->array_remove_empty($haystack[$key]);
      }

      if (empty($haystack[$key]) || $haystack[$key] == "")
      {
        unset($haystack[$key]);
      }
    }

    //return $haystack;
  }

}

?>